home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / MISC / HCAL-27 / LINELOSS.BAS (.txt) < prev    next >
Encoding:
GW-BASIC  |  1997-01-28  |  4.9 KB  |  165 lines

  1. 10  'LINELOSS - Losses in Transmission Lines - 28 APR 94 rev. 27 SEP 96
  2. 20  IF EX$=""THEN EX$="EXIT"
  3. 30  IF PROG$=""THEN GO$=EX$ ELSE GO$=PROG$
  4. 40  COMMON EX$,PROG$
  5. 50  CLS:KEY OFF
  6. 60  COLOR 7,0,1
  7. 70  U1$="#,###.###"
  8. 80  UL$=STRING$(80,205)
  9. 90  E$=STRING$(80,32)
  10. 100  '
  11. 110  '.....start
  12. 120  CLS
  13. 130  COLOR 15,2
  14. 140  PRINT " TRANSMISSION LINE LOSSES";TAB(57);"by George Murphy VE3ERP ";
  15. 150  COLOR 1,0:PRINT STRING$(80,"<0xDF!>");
  16. 160  COLOR 7,0
  17. 170  GOSUB 1080      'preface
  18. 180  COLOR 0,7:LOCATE 25,22
  19. 190  PRINT " Press 1 to continue or 0 to EXIT.....";
  20. 200  COLOR 7,0
  21. 210  Z$=INKEY$:IF Z$=""THEN 210
  22. 220  IF Z$="0"THEN CLS:CHAIN GO$
  23. 230  IF Z$="1"THEN 250
  24. 240  GOTO 210
  25. 250  GOSUB 1520     'screen dump
  26. 260  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  27. 270  PRINT " Press number in < > to choose standard unit of measure:"
  28. 280  PRINT UL$;
  29. 290  PRINT "   < 1 >  Metric"
  30. 300  PRINT "   < 2 >  U.S.A./Imperial"
  31. 310  Z$=INKEY$
  32. 320  IF Z$="1"THEN UM=0.3048:UM$="m.":GOTO 350
  33. 330  IF Z$="2"THEN UM=1:UM$="ft.":GOTO 350
  34. 340  GOTO 310
  35. 350  '.....inputs
  36. 360  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  37. 370  PRINT " Press <ENTER> to by-pass any of the following inputs:"
  38. 380  PRINT " (If you by-pass an essential input you will be asked for it again)"
  39. 390  PRINT UL$;
  40. 400  IF LG THEN 440
  41. 410  PRINT " ENTER: Length of transmission line (";UM$;")......................";
  42. 420  IF UM$="m."THEN PRINT ".";
  43. 430  INPUT LG:LG=LG/UM:GOSUB 620
  44. 440  IF FQ THEN 470
  45. 450  INPUT " ENTER: Frequency (MHz)........................................";FQ
  46. 460  GOSUB 620
  47. 470  IF DB THEN 510
  48. 480  PRINT " ENTER: Attenuation of line (dB per 100 ";UM$;") when matched......";
  49. 490  IF UM$="m."THEN PRINT ".";
  50. 500  INPUT DB:DB=DB*UM:GOSUB 620
  51. 510  IF SL THEN 550
  52. 520  INPUT " ENTER: SWR at load (e.g. antenna).............................";SL
  53. 530  IF SL=1 THEN SL=1.00001
  54. 540  GOSUB 620
  55. 550  IF SI THEN 590
  56. 560  INPUT " ENTER: SWR at input (e.g.transmitter or transmatch)............";SI
  57. 570  IF SI=1 THEN SI=1.00001
  58. 580  GOSUB 620
  59. 590  VIEW PRINT 6 TO 24:CLS:VIEW PRINT:LOCATE 6
  60. 600  GOTO 360
  61. 610  '
  62. 620  '.....calculate
  63. 630  FOR Z=1 TO 3
  64. 640  IF LG=0 AND M<>0    THEN LG=M/0.3048
  65. 650  IF A=0 AND SI<>0    THEN A=(SI+1)/(SI-1)
  66. 660  IF B=0 AND DB*LG<>0 THEN LM=DB*LG/100:B=10^(LM/10)
  67. 670  IF C=0 AND SL<>0    THEN C=(SL-1)/(SL+1)
  68. 680  IF SL=0 AND A*B<>0  THEN SL=(A+B)/(A-B)
  69. 690  IF SI=0 AND B*C<>0  THEN SI=(B+C)/(B-C)
  70. 700  IF L1=0 AND B*C<>0  THEN L1=B^2-C^2:L2=B*(1-C^2)
  71. 710  IF L1*L2<>0 AND L2<=0 THEN 770
  72. 720  IF LT=0 AND L1*L2<>0  THEN LT=10*LOG(L1/L2)/LOG(10) 'base 10
  73. 730  IF SI*SL*LT*FQ THEN 850
  74. 740  NEXT Z
  75. 750  RETURN
  76. 760  '
  77. 770  '.....infinite SWR
  78. 780  BEEP:PRINT:COLOR 15,4
  79. 790  PRINT " Line loss is excessively high. SWR is infinite............"
  80. 800  PRINT " .............Press any key to start over.................."
  81. 810  COLOR 7,0
  82. 820  IF INKEY$=""THEN 820
  83. 830  CLS:RUN EX$
  84. 840  '
  85. 850  '.....print
  86. 860  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  87. 870  PRINT " Length of transmission line...................";
  88. 880  PRINT USING U1$;LG*UM;:PRINT " ";UM$
  89. 890  PRINT " Frequency.....................................";
  90. 900  PRINT USING "#####.###";FQ;:PRINT " MHz"
  91. 910  PRINT " Attenuation per 100 ";UM$;" of line when matched..";
  92. 920  IF UM$="m."THEN PRINT ".";
  93. 930  PRINT USING U1$;DB/UM;:PRINT " dB @";:PRINT FQ;"MHz"
  94. 940  PRINT " SWR at load (e.g. antenna)....................";
  95. 950  PRINT USING U1$;SL;:PRINT " : 1"
  96. 960  PRINT " SWR at input (e.g. transmitter / transmatch)..";
  97. 970  PRINT USING U1$;SI;:PRINT " : 1"
  98. 980  PRINT " Attenuation of line when matched..............";
  99. 990  PRINT USING U1$;LM;:PRINT " dB"
  100. 1000  PRINT " Additional loss due to SWR....................";
  101. 1010  PRINT USING U1$;LT-LM;:PRINT " dB"
  102. 1020  PRINT " Total loss in line............................";
  103. 1030  PRINT USING U1$;LT;:PRINT " dB"
  104. 1040  PRINT UL$;
  105. 1050  GOSUB 1520
  106. 1060  GOTO 110   'start
  107. 1070  '
  108. 1080  '.....text
  109. 1090  T=7     'tab
  110. 1100  PRINT TAB(T);
  111. 1110  PRINT "It is impossible to give a specific relationship between line loss"
  112. 1120  PRINT TAB(T);
  113. 1130  PRINT "and frequency that will apply to all types of lines. Losses are"
  114. 1140  PRINT TAB(T);
  115. 1150  PRINT "due to many factors, such as the characteristics of the dielectric,"
  116. 1160  PRINT TAB(T);
  117. 1170  PRINT "whether the dielectric is air or a manufactured material, and on"
  118. 1180  PRINT TAB(T);
  119. 1190  PRINT "the line's construction, tolerances, installation, age, and state"
  120. 1200  PRINT TAB(T);
  121. 1210  PRINT "of deterioration. Furthermore, the same lines from different"
  122. 1220  PRINT TAB(T);
  123. 1230  PRINT "suppliers often have substantially different loss characteristics."
  124. 1240  PRINT
  125. 1250  PRINT TAB(T);
  126. 1260  PRINT"To use this program it is necessary to enter the loss in dB per"
  127. 1270  PRINT TAB(T);
  128. 1280  PRINT"unit length at a specific frequency for the transmission line under"
  129. 1290  PRINT TAB(T);
  130. 1300  PRINT"consideration. For the reasons stated above this data cannot be"
  131. 1310  PRINT TAB(T);
  132. 1320  PRINT"calculated accurately. However, for purposes of this program "
  133. 1330  PRINT TAB(T);
  134. 1340  PRINT"approximate data will suffice. This data can be found in graph form"
  135. 1350  PRINT TAB(T);
  136. 1360  PRINT"in the ARRL HANDBOOK, the ARRL Antenna Book, or the ARRL Electronics"
  137. 1370  PRINT TAB(T);
  138. 1380  PRINT"Data Book."
  139. 1390  PRINT
  140. 1400  PRINT TAB(T);
  141. 1410  PRINT "HAMCALC's ";CHR$(34);"COAXIAL CABLE CHARACTERISTICS";CHR$(34);
  142. 1420  PRINT " program can also provide"
  143. 1430  PRINT TAB(T);
  144. 1440  PRINT "estimated dB losses at any frequency for coaxial cable transmission"
  145. 1450  PRINT TAB(T);
  146. 1460  PRINT "lines."
  147. 1470  PRINT
  148. 1480  PRINT TAB(T);
  149. 1490  PRINT "This program was developed from a concept by GNEWran Hosinsky, EA8YU."
  150. 1500  RETURN
  151. 1510  '
  152. 1520  'HARDCOPY
  153. 1530  GOSUB 1640:LOCATE 25,2:COLOR 14,6
  154. 1540  PRINT " Press 1 to print screen, 2 to print screen & ";
  155. 1550  PRINT "advance paper, or 3 to continue.";:COLOR 7,0
  156. 1560  Z$=INKEY$:IF Z$="3"THEN GOSUB 1640:RETURN
  157. 1570  IF Z$="1"OR Z$="2"THEN GOSUB 1640:GOTO 1590
  158. 1580  GOTO 1560
  159. 1590  FOR QX=1 TO 24:FOR QY=1 TO 80
  160. 1600  LPRINT CHR$(SCREEN(QX,QY));
  161. 1610  NEXT QY:NEXT QX
  162. 1620  IF Z$="2"THEN LPRINT CHR$(12)
  163. 1630  GOTO 1530
  164. 1640  LOCATE 25,1:PRINT STRING$(80,32);:RETURN
  165.